//
//  UIButton+GG.h
//  unzip
//
//  Created by yg on 2021/11/21.
//

#import <UIKit/UIKit.h>

#pragma mark - 设置按钮文字和图片的间距
typedef NS_ENUM(NSInteger, GGPosition) {
	GGPositionDefault               = 0,
	GGPositionImageLeftAndTextRight = 1,            //图片在左，文字在右，默认
	GGPositionImageRightAndTextLeft = 2,            //图片在右，文字在左
	GGPositionImageTopAndTextBottom = 3,            //图片在上，文字在下
	GGPositionImageBottomAndTextTop = 4,            //图片在下，文字在上
};

@interface UIButton (GG)

//快速创建常规点击按钮
+ (UIButton *)gg_customClickWithTitle:(NSString *)title
							titleFont:(UIFont *)titleFont
								image:(UIImage *)image
						   foreground:(UIColor *)foreground
						   background:(id)background;

//快速创建状态按钮
+ (UIButton *)gg_customSwitchWithNoSelectedTitle:(NSString *)noSelectedTitle
								 noSelectedImage:(UIImage *)noSelectedImage
							noSelectedTitleColor:(UIColor *)noSelectedTitleColor
								   selectedTitle:(NSString *)selectedTitle
								   selectedImage:(UIImage *)selectedImage
							  selectedTitleColor:(UIColor *)selectedTitleColor
									   titleFont:(UIFont *)titleFont;

+ (UIButton *)gg_customSwitchWithNoSelectedTitle:(NSString *)noSelectedTitle
							   noSelectedBGColor:(UIColor *)noSelectedBGColor
							noSelectedTitleColor:(UIColor *)noSelectedTitleColor
								   selectedTitle:(NSString *)selectedTitle
								 selectedBGColor:(UIColor *)selectedBGColor
							  selectedTitleColor:(UIColor *)selectedTitleColor
									   titleFont:(UIFont *)titleFont;

- (void)setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state;
- (void)gg_setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state;

@end


@interface UIButton (GGPosition)
//（BUG：内容会整体向上偏移  待解决）
- (void)gg_setPosition:(GGPosition)postion spacing:(CGFloat)spacing;
- (void)gg_setPosition:(GGPosition)position spacing:(CGFloat)spacing imageSize:(CGSize)imageSize;
- (void)gg_updatePositionLayout;

@end


